
package com.sdk.widget.threescreen.scrollview;

import com.android.sdk.R;
import com.sdk.widget.threescreen.scrollview.ScrollableView.PageEventObserver;
import com.sdk.widget.threescreen.scrollview.ScrollableView.PageProvider;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;

public class DolphinTestActivity extends Activity {
    /** Called when the activity is first created. */

    private LinearLayout centerPageLayout;

    private ViewGroup mActivityContent;

    private ScrollPageView mContentView;

    LayoutParams COVER_SCREEN_PARAMS = new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mActivityContent = (ViewGroup)findViewById(android.R.id.content);

        final View browserFrameLayout = LayoutInflater.from(this).inflate(R.layout.scrollableview,
                null);

        final ScrollableView scrollablePageView = (ScrollableView)browserFrameLayout
                .findViewById(R.id.scrollable_view);
        scrollablePageView.setPageEventObserver(mPageEventObserver);
        scrollablePageView.setPageProvider(mPageProvider);
        scrollablePageView.setScrollable(true);

        mContentView = scrollablePageView.getMiddlePageView();
        mContentView.setClickable(true);
        mActivityContent.addView(browserFrameLayout, COVER_SCREEN_PARAMS);

        centerPageLayout = (LinearLayout)LayoutInflater.from(this).inflate(R.layout.main, null);

        // setContentView(mActivityContent);

        scrollablePageView.showLeftPageView(false);
    }

    PageEventObserver mPageEventObserver = new PageEventObserver() {

        @Override
        public void onLeftPageShown(ScrollPageView paramPageView) {
            Log.e(" ====== ", " onLeftPageShown ");
        }

        @Override
        public void onMiddlePageShown(ScrollPageView paramPageView) {
            Log.e(" ====== ", " onMiddlePageShown ");
        }

        @Override
        public void onRightPageShown(ScrollPageView paramPageView) {
            Log.e(" ====== ", " onRightPageShown ");
        }
    };

    PageProvider mPageProvider = new PageProvider() {

        @Override
        public boolean requestRightPage(ScrollPageView pageView) {
            Log.e(" ====== ", " requestRightPage ");
            return false;
        }

        @Override
        public boolean requestLeftPage(ScrollPageView pageView) {
            Log.e(" ====== ", " requestLeftPage ");
            return false;
        }
    };
}
